package edu.bu.cs673.superkids123;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
	/**
	 * @author Abdelghani Bhalla
	 */

	private static SessionFactory sessionFactory;
	
	static{
		try{
			sessionFactory = new Configuration().configure().buildSessionFactory();
		}catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
	public static void setSessionFactory(SessionFactory factory) { 
		HibernateUtil.sessionFactory = factory; 
		} 

	public static void shutdown(){
		getSessionFactory().close();
	}
}

